/*
 * fw_powermode.c
 *
 *  Created on: 2021年2月11日
 *      Author: taoyu
 */

#include "framework_types.h"
#include "powermode.h"
#include "scheduler.h"
#include "framework_hooks.h"

void powermode_init(void)
{
	scheduler_init();
	powermodeHook_init();
}

void powermode_main(void)
{
	// dead loop
	for(;;)
	{
		// run awake mode
		scheduler_awake();

		// enter sleep
		powermodeHook_sleep();

		// run asleep mode
		scheduler_asleep();

		// exit sleep
		powermodeHook_wakeUp();
	}
}

void powermode_requestWakeUp(uint8 reason)
{
	scheduler_requestWakeUp(reason);
}
